package com.txy.springcloud.service.dubbo;

import com.txy.springcloud.util.SendEmail_text;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Value;

@Service
public class EmailServiceImpl implements EmailService {

    @Value("${email.sender.username}")
    private String username;

    @Value("${email.sender.password}")
    private String password;

    @Override
    public boolean sendCode(String email, String code) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    SendEmail_text.send(email, "验证码", code);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();
        return true;
    }
}
